/*
 * Copyright (c) 2005, 2014 vacoor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
Ext.define('Nothing.store.Users', {
        extend: 'Ext.data.Store',
        uses: ['Nothing.ux.data.writer.Form'],  //TODO

        model: 'Nothing.model.User',
        autoLoad: true,

        proxy: {
            type: 'ajax',
            defaultWriterType: 'form',  // TODO 等待服务器端容易处理json(包含批量json create/update)时候废弃
            reader: {
                readRecordsOnFailure: false, // 当失败时不读取 records
                successProperty: 'success', // 只有当 === false || === 'false' 才认为false
                messageProperty: 'message',
                totalProperty: 'recordCount',
                root: 'data'
            },

            api: {
                read: 'users/list',
                create: 'users/create',
                update: 'users/update',
                destroy: 'users/delete'
            }
        }
    }
);
